﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Xpom_Xpum__Integrated_Development_Environment.Data.Configuration;

namespace Xpom_Xpum__Integrated_Development_Environment.View
{
    /// <summary>
    /// Interaction logic for AboutWindowView.xaml
    /// </summary>
    public partial class AboutWindowView : Window
    {
        #region Constructor

        public AboutWindowView()
        {
            InitializeComponent();
        }

        #endregion

        #region Commands

        #endregion

        #region Fields

        #endregion

        #region Properties

        #endregion

        #region Methods

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Hide();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var animation = new DoubleAnimation();
            animation.From = 0;
            animation.To = 1;
            animation.Duration = TimeSpan.FromMilliseconds(750);
            textBlock1.BeginAnimation(TextBlock.OpacityProperty, animation);
            var anim = new ThicknessAnimation();
            anim.From = new Thickness(12, -(textBlock1.Height), 0, 0);
            anim.To = new Thickness(12, 14, 0, 0);
            anim.Duration = TimeSpan.FromMilliseconds(750);
            textBlock1.BeginAnimation(TextBlock.MarginProperty, anim);
            
            var animation3 = new DoubleAnimation();
            animation3.From = 0;
            animation3.To = 1;
            animation3.Duration = TimeSpan.FromMilliseconds(750);
            textBlock3.BeginAnimation(TextBlock.OpacityProperty, animation3);
            var anim3 = new ThicknessAnimation();
            anim3.From = new Thickness(177, -(textBlock3.Height), 0, 0);
            anim3.To = new Thickness(177, 14, 0, 0);
            anim3.Duration = TimeSpan.FromMilliseconds(750);
            textBlock3.BeginAnimation(TextBlock.MarginProperty, anim3);

            var animation2 = new DoubleAnimation();
            animation2.From = 0;
            animation2.To = 1;
            animation2.Duration = TimeSpan.FromMilliseconds(750);
            textBlock2.BeginAnimation(TextBlock.OpacityProperty, animation2);

            /*var animation3 = new DoubleAnimation();
            animation3.From = 0;
            animation3.To = 1;
            animation3.Duration = TimeSpan.FromMilliseconds(750);
            button1.BeginAnimation(TextBlock.OpacityProperty, animation3);*/
        }

        private void expander1_Expanded(object sender, RoutedEventArgs e)
        {
            var animation = new DoubleAnimation();
            animation.From = this.Height;
            animation.To = this.Height + 180;
            animation.Duration = TimeSpan.FromMilliseconds(750);
            animation.Completed += (o, ea) =>
            {
                webBrowser1.Visibility = System.Windows.Visibility.Visible;
                webBrowser1.Navigate(new Uri("file:///" + GlobalSettings.SDKPath + "License.html"));
            };
            this.BeginAnimation(Window.HeightProperty, animation);

        }

        private void expander1_Collapsed(object sender, RoutedEventArgs e)
        {
            webBrowser1.Visibility = System.Windows.Visibility.Collapsed;

            var animation = new DoubleAnimation();
            animation.From = this.Height;
            animation.To = this.Height - 180;
            animation.Duration = TimeSpan.FromMilliseconds(750);
            this.BeginAnimation(Window.HeightProperty, animation);
        }

        #endregion
    }
}
